package com.example.eurekaclient.controller;

import com.example.eurekaclient.model.User;
import com.example.eurekaclient.service.SchedualServiceHello;
import com.example.eurekaclient.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {

    @Autowired
    SchedualServiceHello serviceHello;

    @Autowired
    TestService testService;

    @GetMapping(value = "/sayHello")
    public String sayHello(@RequestParam String name) {
        return serviceHello.sayHelloFromClientOne( name );
    }

    @GetMapping(value = "/welcome")
    public String welcome(){
        return "success";
    }

    @PostMapping(value = "/getUser")
    public User getUser(@RequestBody User user){
        return testService.getUser(user);
    }

    @PostMapping(value = "/getParam")
    public String getParam(@RequestParam(value = "name") String name){
        return testService.postParam(name);
    }


}
